package com.tanhua.manage.controller;

import com.tanhua.manage.service.AnalysisService;
import com.tanhua.manage.vo.AnalysisUsersVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class AnalysisController {
    @Autowired
    private AnalysisService analysisService;
    /**
     * 接口名称：概要统计信息
     * 接口路径：GET/dashboard/summary
     */
    @GetMapping("dashboard/summary")
    public ResponseEntity<Object> summary(){
        return analysisService.summary();
    }
    @GetMapping("dashboard/users")
    public AnalysisUsersVo getUsers(@RequestParam(name = "sd")Long sd, @RequestParam(name = "ed")Long ed, @RequestParam(name = "type")Integer type){
        log.info("新增、活跃用户、次日留存率");
        return analysisService.queryAnalysisUsersVo(sd,ed,type);
    }
}